package jiaxa.com.jsbridge.activity;

import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;

import jiaxa.com.jsbridge.R;

public class IntroActivity extends AppIntro {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);  //隐藏标题栏，setContentView之前调用，否则无效。

        getSupportActionBar().hide();
        addSlide(AppIntroFragment.newInstance("", "", R.drawable.img_sp, Color.parseColor("#000000")));
        addSlide(AppIntroFragment.newInstance("哈哈", "描述", R.drawable.img_sp, Color.parseColor("#00FF00")));
        addSlide(AppIntroFragment.newInstance("哈哈", "描述", R.drawable.img_sp, Color.parseColor("#0000FF")));

        setSkipText("跳过");
//                setBarColor(Color.parseColor("#3F51B5"));
//                setSeparatorColor(Color.parseColor("#2196F3"));
        setDoneText("完成");

//        setProgressButtonEnabled(true);
        Resources resources = getResources();
        Drawable drawable = resources.getDrawable(R.drawable.ic_arrow_forward_white);//获取drawable
        drawable.setBounds(0,0,12,12);
        setImageNextButton(drawable);
        setSwipeLock(false);  //不允许滑动
//        setImageNextButton();
        setNextArrowColor(Color.WHITE);
//        setNextPageSwipeLock(true);
        setColorSkipButton(Color.WHITE);
        setColorDoneText(Color.WHITE);
        setVibrate(true);
        setVibrateIntensity(10);
        setFadeAnimation(); // OR
        //        askForPermissions(new String[]{Manifest.permission.CAMERA}, 3);
    }


    @Override
    public void onSkipPressed(Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        // Do something when users tap on Skip button.
    }

    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        finish();
        // Do something when users tap on Done button.
    }

    @Override
    public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
        super.onSlideChanged(oldFragment, newFragment);
        // Do something when the slide changes.
    }
}
